package com.greydawn.MementoPattern.gameExp;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: zhongwr
 * @Create: 2021/12/19 14:46
 * @Version 1.0
 * @Description: 备忘录管理类
 */
public class GameMementoManager {

    private List<GameMemento> gameMementoList = new ArrayList<GameMemento>();

    public void addMemento(GameMemento gameMemento) {
        this.gameMementoList.add(gameMemento);
    }

    public GameMemento getByIndex(int index) {
        return this.gameMementoList.get(index);
    }

    public void showMementoList() {
        for (int i = 0; i < this.gameMementoList.size(); i++) {
            System.out.println("存档：" + i + " 属性值：" + this.gameMementoList.get(i));
        }
    }

}
